<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>结算</title>
    <link rel="stylesheet" href="./css/reset.css">
    <link rel="stylesheet" href="./css/public.css">
    <link rel="stylesheet" href="./css/mycart.css">
</head>

<body>
    <!-- 头部 -->
    <div id="header">
        <div class="header-wrap">
            <h1><img src="./images/fila_blue_150.png" alt="" class="dom_center"></h1>
            <div class="header-right">
                <input type="text" placeholder="短袖"><button>搜索</button>
                <a href="" class="enter">登入</a>
                <a href="" class="login">注册</a>
                <a href="" class="shop_cart"><img src="./images/cart-blue.png" alt=""></a>
            </div>
        </div>
    </div>
    <!-- 内容 -->
    <div class="cart-wrap">
        <div>
            <span class="title">我的购物车</span><i class="sumto">共计2</i>
        </div>
        <div class="cart-top">
            <label class="checkbox-label">
                <input type="checkbox" checked="checked" class="checkbox-input">
                <span>全选</span>
            </label>
        </div>
        <div class="cart-bottom">
            <div class="cart-con float_left">
                <label class="checkbox-label">
                    <input type="checkbox" checked="checked" class="checkbox-input">
                </label>
            </div>
            <div class="cart-c float_left">
                <img src="./images/1.jpg" alt="">
                <h5>运动鞋</h5>
                <p class="float_left">颜色：黑色</p>
                <p class="float_left">数量(1)</p>
            </div>
            <div class="cart-r">
                <p>￥1000.00</p>
                <a href="">删除</a>
            </div>
        </div>
    </div>
    <!-- 底部 -->
    <div id="foot">
        <div class="foot-wrap">
            <h6 class="price float_left">总价：￥1280.00</h6>
            <a href="/account.html" class="jiesuan">结算</a>
        </div>
    </div>
    <div class="service">
        <a href="">客服</a>
    </div>
    <script src="./js/jquery.min.js"></script>
    <script>
        $(function(){
            let id = window.location.href.slice(window.location.href.indexOf("?") + 4)
              console.log(id)
              $.ajax({
                  url:"http://127.0.0.1:81/getDetails",
                  data:{
                      id:id
                  },
                  success:function(data){
                    //   console.log(data)
                      JSON.parse(data).forEach(item => {
                        $(".cart-c h5").html(item.name)
                        $(".cart-c img").attr("src",`./images/${item.src}`)
                        $(".cart-r p").html(`￥${item.price}.00`)
                        $(".jiesuan").attr("href",`account.html?id=${item.id}`)
                        $(".price").html(`总价：￥${item.price}.00`)
                      })
                  }
              })
        })
    </script>
</body>

</html>